program prod
implicit none

double precision, dimension(4) :: a
integer, dimension(2) :: b
integer :: i

b(1) = 2
b(2) = 4

do i  = 1, 4
  a(i) = dble(i)
end do

write(*,*) product(a(b(:)))
end program
